package com.greentravel.model;

import java.util.Date;

/**
 * 用户动态实体类
 * 存储用户发布的绿色出行相关动态
 */
public class Moment {
    private int id; // 动态ID
    private int userId; // 用户ID
    private String content; // 动态内容
    private Date publishTime; // 发布时间
    private int likeCount; // 点赞数
    private int commentCount; // 评论数

    // 默认构造方法
    public Moment() {
    }

    // 带参数的构造方法
    public Moment(int id, int userId, String content, Date publishTime, int likeCount, int commentCount) {
        this.id = id;
        this.userId = userId;
        this.content = content;
        this.publishTime = publishTime;
        this.likeCount = likeCount;
        this.commentCount = commentCount;
    }

    // 新增动态用的构造方法
    public Moment(int userId, String content) {
        this.userId = userId;
        this.content = content;
        this.publishTime = new Date();
        this.likeCount = 0;
        this.commentCount = 0;
    }

    // getter和setter方法
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getPublishTime() {
        return publishTime;
    }

    public void setPublishTime(Date publishTime) {
        this.publishTime = publishTime;
    }

    public int getLikeCount() {
        return likeCount;
    }

    public void setLikeCount(int likeCount) {
        this.likeCount = likeCount;
    }

    public int getCommentCount() {
        return commentCount;
    }

    public void setCommentCount(int commentCount) {
        this.commentCount = commentCount;
    }

    @Override
    public String toString() {
        return "Moment{" +
                "id=" + id +
                ", userId=" + userId +
                ", content='" + content + '\'' +
                ", publishTime=" + publishTime +
                ", likeCount=" + likeCount +
                ", commentCount=" + commentCount +
                '}';
    }
}